<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <input type="button" value="全选" id="choose">
    <input type="button" value="取消选择" id="cancel">
    <hr />
    <div id="div">
        <input type="checkbox" />蜜桃四季春<br />
        <input type="checkbox" />伯爵红茶<br />
        <input type="checkbox" />黄桃果霸<br />
        <input type="checkbox" />芋圆奶茶<br />
        <input type="checkbox" />森林玫果
    </div>
</body>
<script>
    let element = document.getElementById('choose')
    element.onclick = function () {
        let cbArrary = document.querySelectorAll("input[type='checkbox']")
        for (let cb of cbArrary) {
            cb.checked = true
        }
    }

    let element2 = document.getElementById('cancel')
    element2.onclick = function () {
        let cbArrary2 = document.querySelectorAll("input[type='checkbox']")
        for (let cb of cbArrary2) {
            cb.checked = false
        }
    }
</script>

</html>